from redis import *
if __name__=="__main__":
    try:
        #创建StrictRedis对象，与redis服务器建⽴连接
        sr=StrictRedis(host="192.168.1.61",
        port=6379,
        db=0,)
        #添加键name，值为itheima
        # result=sr.set('name2','itheima')
        #输出响应结果，如果添加成功则返回True，否则返回False
        # print(result)
        result2=sr.get('name2')
        print(result2)
        resKes=sr.keys()
        print(resKes)
        for value in resKes:
            print(value)
            sr.delete(value)
    except Exception as e:
        print(e)